package com.tledu.service.impl;

import com.tledu.mapper.DepartmentMapper;
import com.tledu.mapper.UserMapper;
import com.tledu.model.Department;
import com.tledu.model.User;
import com.tledu.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class DepartmentServiceImpl implements DepartmentService {
    @Autowired
    private DepartmentMapper departmentMapper;


    @Override
    public List<Department> department(Map<String, Object> map) {
        Integer cpage = (Integer) map.get("cpage");
        Integer pageSize = (Integer) map.get("pageSize");
        Integer start = (cpage - 1) * pageSize;
        map.put("start", start);
        return departmentMapper.department(map);
    }

    @Override
    public int departmentCount() {
        return departmentMapper.departmentCount();
    }

    @Override
    public String showNote(Integer department_id) {
        return departmentMapper.showNote(department_id);
    }

    @Override
    public void updateNote(Map<String, Object> map) {
        departmentMapper.updateNote(map);
    }

    @Override
    public int Add(Department department) {
        return departmentMapper.Add(department);
    }

    @Override
    public List<Department> Sclect_id(String department_id) {
        return departmentMapper.Sclect_id(department_id);
    }

    @Override
    public void Delete_id(Integer department_id) {
        departmentMapper.Delete_id(department_id);
    }

    @Override
    public int DeleteAll(String department_id) {
        return departmentMapper.DeleteAll(department_id);
    }
}
